import java.util.*;
import java.io.*;
//平方数
 class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long x = in.nextLong();
        long l = 1, r = x;
        long best = 1;

        while (l <= r) {
            long mid = l + (r - l) / 2;
            if (mid > x / mid) {  // 避免 mid * mid 溢出
                r = mid - 1;
            } else {
                best = mid; // mid 可能是 sqrt(x) 或最接近 sqrt(x) 的整数
                l = mid + 1;
            }
        }

        // 计算最接近 x 的平方数
        long square1 = best * best;
        long square2 = (best + 1) * (best + 1);
        System.out.println(Math.abs(x - square1) <= Math.abs(x - square2) ? square1 : square2);
    }
}





//分组
 class Main2 {
    public static int n, m;
    public static Map<Integer, Integer> hash = new HashMap<>();

    public static boolean check(int x) { // 判断最多人数为 x 时，能否分成 m 组
        int g = 0;
        for (int a : hash.values()) {
            g += (a + x - 1) / x; // 等价于 a / x + (a % x == 0 ? 0 : 1)
        }
        return g <= m;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();

        int hmax = 0;
        for (int i = 0; i < n; i++) {
            int x = in.nextInt();
            hash.put(x, hash.getOrDefault(x, 0) + 1);
            hmax = Math.max(hmax, hash.get(x));
        }

        // 边界情况处理
        if (hash.size() > m) {
            System.out.println(-1);
            return;
        }
        if (n == m) {
            System.out.println(1); // 每人一组
            return;
        }
        if (m == 1) {
            System.out.println(hmax); // 所有人在同一组
            return;
        }

        // 二分查找
        int l = 1, r = hmax;
        while (l < r) {
            int mid = l + (r - l) / 2;
            if (check(mid)) r = mid;
            else l = mid + 1;
        }
        System.out.println(l);
    }
}





//【模板】拓扑排序
 class Main3 {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(reader.readLine());
        int n = Integer.parseInt(st.nextToken()); // 节点数
        int m = Integer.parseInt(st.nextToken()); // 边数

        List<Integer>[] graph = new ArrayList[n + 1]; // 邻接表
        int[] inDegree = new int[n + 1]; // 入度数组

        for (int i = 1; i <= n; i++) {
            graph[i] = new ArrayList<>();
        }

        for (int i = 0; i < m; i++) {
            st = new StringTokenizer(reader.readLine());
            int u = Integer.parseInt(st.nextToken());
            int v = Integer.parseInt(st.nextToken());
            graph[u].add(v);
            inDegree[v]++;
        }

        // 使用优先队列（小根堆）保证字典序最小
        Queue<Integer> queue = new PriorityQueue<>();
        for (int i = 1; i <= n; i++) {
            if (inDegree[i] == 0) {
                queue.offer(i);
            }
        }

        StringBuilder sb = new StringBuilder();
        int count = 0; // 统计加入拓扑排序的节点数

        while (!queue.isEmpty()) {
            int node = queue.poll();
            sb.append(node).append(" ");
            count++;

            for (int neighbor : graph[node]) {
                inDegree[neighbor]--;
                if (inDegree[neighbor] == 0) {
                    queue.offer(neighbor);
                }
            }
        }

        if (count == n) {
            System.out.println(sb.toString().trim()); // 输出结果，去掉最后的空格
        } else {
            System.out.println(-1); // 存在环
        }
    }
}

